<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //  一天吃一半加1个,十天之后只剩一个.有多少个桃子
        let num = 0;
        let x = 0;

        function getSum() {
            num++;
            if (num == 10) return 1;
            x = (getSum() + 1) * 2;
            return x;
        }
        console.log(getSum());
    </script>
</body>

</html>